<%--
  Created by IntelliJ IDEA.
  User: aa324
  Date: 2023/6/18
  Time: 15:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>${sessionScope.film.getName()}电影详情</title>
    <script src="./lib/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="./lib/bootstrap/css/bootstrap.min.css">
    <style>
        #back{
            position: absolute;
            right: 0;
            bottom: 20%;
            width: 5em;
            height: 3em;
            color: #2c3e50;
            background-color: #ecf0f1;
            border-radius: 0.5rem 0 0 0.5rem;
            display: inline-flex;
            justify-content: center;
            align-items: center;
            text-decoration: none;
            box-shadow: 2px 2px 3px black;
            font-weight: bold;
        }
        #back:hover{
            color: white;
            background-color: darkgray;
        }
        .noFocus:focus{
            outline: none!important;
            cursor: default;
        }
    </style>
</head>
<body>
    <div class="container-md">
        <form action="/dyp/placeOrderServlet">
            <h2 class="h4">${sessionScope.film.getName()}</h2>
            <div class="form-group row">
                <label for="filmId" class="col-form-label col-1">电影ID：</label>
                <div class="col-1">
                    <input type="text" class="form-control-plaintext noFocus" name="filmId" value="${sessionScope.film.getId()}" id="filmId" readonly>
                </div>
            </div>
            <div class="row">
                <p class="col-2">电影时长：<c:out value="${sessionScope.film.getTime()}" /></p>
                <p class="col-2">分类：<c:out value="${sessionScope.film.getClassify()}" /></p>
            </div>
            <div class="form-group row">
                <label for="price" class="col-form-label col-1">票价：</label>
                <div class="col-1">
                    <input type="text" name="price" class="form-control-plaintext" id="price" value="${sessionScope.film.getPrice()}" disabled>
                </div>
            </div>
            <div class="form-group">
                <label for="nums">购票数量：</label>
                <input type="text" name="nums" class="form-control col-2" id="nums">
            </div>
            <div class="form-group row">
                <label for="all" class="col-form-label col-1">总价：</label>
                <div class="col-1">
                    <input type="text" name="all" class="form-control-plaintext noFocus" id="all" readonly>
                </div>
            </div>
            <input type="submit" class="btn btn-info" value="下单">
        </form>
        <a href="${pageContext.request.contextPath}/filmList.jsp" id="back">返回主页</a>
    </div>
</body>
<script>
    let dom = {
        price: document.getElementById("price"),
        nums: document.getElementById("nums"),
        all: document.getElementById("all")
    }
    dom.nums.onblur = function (){
        dom.all.value = dom.price.value * dom.nums.value;
    }
</script>
</html>
